// Main.cs
// 
// Copyright © 2008 David Paleino <d.paleino@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

using System;
using System.Runtime.InteropServices;

namespace Exiv2 {
	public static class Utils {
		[DllImport ("libexiv2")]
		static extern bool _ZN5Exiv210fileExistsERKSsb(char[] path, bool ct);
		/// <summary>
		/// Test if a file exists. 
		/// </summary>
		/// <param name="path">
		/// A <see cref="System.String"/>, the file to check.
		/// </param>
		/// <returns>
		/// A <see cref="System.Boolean"/>, true if <paramref name="path"/>
		/// exists.
		/// </returns>
		public static bool FileExists(string path) {
			return FileExists(path, false);
		}
		/// <summary>
		/// Test if a file exists. 
		/// </summary>
		/// <param name="path">
		/// A <see cref="System.String"/>, the file to check.
		/// </param>
		/// <param name="ct">
		/// A <see cref="System.Boolean"/>, flag to check if
		/// <paramref name="path"/> is a regular file
		/// </param>
		/// <returns>
		/// A <see cref="System.Boolean"/>, true if <paramref name="path "/>
		/// exists.
		/// </returns>
		public static bool FileExists(string path, bool ct) {
			return _ZN5Exiv210fileExistsERKSsb(path.ToCharArray(), ct);
		}
						
		[DllImport ("libexiv2")]
		static extern int _ZN5Exiv213versionNumberEv();
		public static string GetVersion() {
			return Convert.ToString(_ZN5Exiv213versionNumberEv());
		}
	}
}